import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import javax.swing.*;

//@SuppressWarnings("serial")
public class Test extends JPanel {
   private static final int PREF_W = 1200;
   private static final int PREF_H = 720;
   private static final int BI_WIDTH = 100;
   private static final int BI_HEIGHT = 30;

   private JButton buttonOptions = new JButton();
   private Icon nonHoveredIcon;
   private Icon hoveredIcon;

   @Override
   public Dimension getPreferredSize() {
      return new Dimension(PREF_W, PREF_H);
   }

   public Test() {
      hoveredIcon = createIcon("Hovered");
      nonHoveredIcon = createIcon("Non-Hovered");

      buttonOptions.setIcon(nonHoveredIcon);
      buttonOptions.setRolloverIcon(hoveredIcon);

      setLayout(new GridBagLayout());
      GridBagConstraints gbc = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
            GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, new Insets(
                  5, 5, 5, 5), 0, 0);
      add(buttonOptions, gbc);
   }

   private ImageIcon createIcon(String text) {
      BufferedImage img = new BufferedImage(BI_WIDTH, BI_HEIGHT,
            BufferedImage.TYPE_INT_ARGB);
      Graphics g = img.getGraphics();
      g.setColor(Color.black);
      Graphics2D g2 = (Graphics2D) g;
      g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
            RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
      g.drawString(text, 10, 20);
      g.dispose();
      return new ImageIcon(img);
   }

   private static void createAndShowGui() {
      Test mainPanel = new Test();

      JFrame frame = new JFrame("StartScreen");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.getContentPane().add(mainPanel);
      frame.pack();
      frame.setLocationByPlatform(true);
      frame.setVisible(true);
   }

   public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable() {
         public void run() {
            createAndShowGui();
         }
      });
   }
}